import {Component, OnInit} from '@angular/core';
import {NzModalService} from 'ng-zorro-antd/modal';
import {NzMessageService} from 'ng-zorro-antd/message';
import {NzNotificationService} from 'ng-zorro-antd/notification';
import {NzContextMenuService, NzDropdownMenuComponent} from 'ng-zorro-antd/dropdown';

@Component({
  selector: 'app-welcome',
  templateUrl: './welcome.component.html',
  styleUrls: ['./welcome.component.scss']
})
export class WelcomeComponent implements OnInit {
  drawerVisible = false;

  constructor(
    private modal: NzModalService,
    private message: NzMessageService,
    private notification: NzNotificationService,
    private nzContextMenuService: NzContextMenuService,
  ) {
  }

  ngOnInit(): void {
  }

  openModal(): void {
    this.modal.create({
      nzTitle: 'Modal Title',
      nzContent: 'string, will close after 1 sec',
      nzClosable: false,
      nzOnOk: () => {
        console.log(1);
      }
    });
  }

  openMessage(): void {
    this.message.info('This is a normal message');
  }

  openNotify(): void {
    this.notification.create(
      'success',
      'Notification Title',
      'This is the content of the notification. This is the content of the notification. This is the content of the notification.'
    );
  }

  openConfirm(): void {
    console.log(1);
  }

  contextMenu($event: MouseEvent, menu: NzDropdownMenuComponent): void {
    this.nzContextMenuService.create($event, menu);
  }

  openDrawer(): void {
    this.drawerVisible = true;
  }
}
